package com.uzhie.exception;

import com.uzhie.web.bean.ErrorBean;

/**
 * 用户操作自定义错误
 * Created by lilongfei on 2018/7/12.
 */
public class UserException extends BussException {
    private int status = -1;
    private String message;

    public UserException(String error) {
        this(0, error);
    }

    public UserException(int status, String error) {
        super(error);
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public ErrorBean getError(){
        ErrorBean error = new ErrorBean();
        error.setCode(status);
        error.setMsg(getMessage());
        return error;
    }

    public class Status {
        public final static String PWD_ERROR = "用户名或密码错误";
        public final static String OLD_PWD_ERROR = "原始密码错误";
        public final static String NO_POWER = "用户角色没有分配菜单登录权限";
        public final static String NO_ROLES = "用户没有分配角色";
        public final static String POWER_ERROR = "权限异常,请查看权限表";
        public final static String NO_POWER_ERROR = "用户没有分配车辆管理权限";
        public final static String STATUS_ERROR = "用户状态异常";
        public final static String QUERY_STATUS_ERROR = "查询的用户状态异常";
        public final static String USER_ISNULL = "用户对象不能为空";
        public final static String CANT_DELETE = "只有禁用状态下的用户可以被删除";
        public final static String NAME_EXIST = "用户名已经存在";


        public final static String USERNAME_ISNULL = "登录账号不可以为空";
        public final static String PWD_ISNULL = "用户密码不可以为空";
        public final static String REALNAME_ISNULL = "用户名称不可以为空";
        public final static String POWER_ISNULL = "车辆管理权限不可以为空";
        public final static String DEPT_ISNULL = "所属部门不可以为空";
        public final static String INSERT_ERROR = "用户添加失败";
        public final static String ID_ISNULL = "用户ID不可为空";

    }
}
